package com.shujia.homework;

// 编号，名称，单价，出版社
public class Book {

    private String no;
    private String name;
    private double price;
    private String press;

    public Book() {
    }

    public Book(String no, String name, double price, String press) {
        this.no = no;
        this.name = name;
        this.price = price;
        this.press = press;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (Double.compare(book.price, price) != 0) return false;
        if (no != null ? !no.equals(book.no) : book.no != null) return false;
        if (name != null ? !name.equals(book.name) : book.name != null) return false;
        return press != null ? press.equals(book.press) : book.press == null;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = no != null ? no.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        temp = Double.doubleToLongBits(price);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (press != null ? press.hashCode() : 0);
        return result;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getPress() {
        return press;
    }

    public void setPress(String press) {
        this.press = press;
    }

    @Override
    public String toString() {
        return "Book{" +
                "no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", price=" + price +
                ", press='" + press + '\'' +
                '}';
    }
}
